<template>
    <div class="xuqiu">
        <div class="title">
            <span>即時新聞</span>
            <span class="more">更多</span>
        </div>
        <div class="main">
            <div class="main-top">
                <img :src="list[0]?list[0].image:''" alt="">
            </div>
            <div class="main-item" v-for="item in list">
                <a>{{item.content}}</a>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "index-xuqiu",
        data() {
            return {
                list:[]
            }
        },
        mounted() {
            this.getTop10News()
        },
        methods:{
            getTop10News() {
                this.$http.post(this.API.get_top10_news).then((res) => {
                    let $this = this;
                if(res.status ===200 && res.data.length>0){
                    this.list = res.data;
                }
            })
            },
        }
    }
</script>

<style scoped lang="less">
    .xuqiu{
        width: 100%;
        .title{
            height: 40px;
            background-color: #f4f4f4;
            font-size: 20px;
            color: #000000;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 0 12px;
            font-weight: bold;
            .more{
                font-size: 16px;
                color: #7d3e03;
                cursor: pointer;
            }
        }
        .main{
            background-color: #f9f9f9;
            width: 100%;
            /*height: 345px;*/
            overflow: hidden;
            border-right: 1px solid #e6e6e6;
            border-left: 1px solid #e6e6e6;
            border-bottom: 1px solid #e6e6e6;
            box-sizing: border-box;
            padding: 12px;
            .main-top{
                box-sizing: border-box;
                width: 100%;
                height: 150px;
                position: relative;
                margin-bottom: 20px;
                img{
                    width: 100%;
                    height: 100%;
                }
                .tips{
                    width: 100%;
                    height: 30px;
                    line-height: 30px;
                    text-align: center;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    color: #ffffff;
                    background-color: rgba(0,0,0,.5);
                }
            }
            .main-news{
                width: 100%;
            }
            .main-item{
                box-sizing: border-box;
                padding:10px;
                background-color: #ffffff;
                width: 100%;
                font-size: 12px;
                color: gray;
                display: flex;
                flex-direction: column;
                align-items: center;
                cursor: pointer;
                border-bottom: 1px dashed #e6e6e6;
                a{
                    width: 100%;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
                .item-title{
                    color:  #7d3e03;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }
        }
    }

</style>